package com.eagle.epay.config;

import com.lly835.bestpay.config.AliPayConfig;
import com.lly835.bestpay.config.WxPayConfig;
import com.lly835.bestpay.service.BestPayService;
import com.lly835.bestpay.service.impl.BestPayServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
public class BestPayServiceConfig {
	@Autowired
	private WxAccountConfig wxAccountConfig;

	@Autowired
	private AlipayAccountConfig alipayAccountConfig;

	@Bean
	public BestPayService bestPayService(){
		WxPayConfig wxPayConfig = new WxPayConfig();
		//公众号Id
		wxPayConfig.setAppId(this.wxAccountConfig.getAppId());
		wxPayConfig.setMchId(this.wxAccountConfig.getMchId());
		wxPayConfig.setMchKey(this.wxAccountConfig.getMchKey());
		//回调接口，需要启动E:\tools\natapp的natapp
		wxPayConfig.setNotifyUrl(this.wxAccountConfig.getNotifyUrl());

		AliPayConfig aliPayConfig = new AliPayConfig();
//		aliPayConfig.setAppId("2018062960540016");
//		aliPayConfig.setPrivateKey("MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCC/tk1oqymli5HpP9MxOkNofKkON1a6EqKg/S0++mZoKLInLasLkNuz0F8nSg/nBZGMv8XcIOXeOsK1ZT9tibxlgzun22lnBpHLueCAZlqITx33XO8SwiVULar2NIVFJwuUdvHPf/2Wj361cTd+zw+uJTPy3vIBljeOHDajzqBg9m5JrCIOgUze+4MZBT5/74gwwwpMDhRHRfR+4FTFmxqqzbTBGaFv4gCLSRB/3VpuruAP5AKCTR2ATHXgFO9veCemNwx5sI3F9Tw43+16xzAZh2T/6Xb3d31H9k31h9Iai7t2s00qY6eKsFpdi4ySK5qB2G9lbFvbpBv+3gz/5UFAgMBAAECggEANWn7Yc5yPf8w4c/atg/4w7FMgkAZqm7brj1+M6ogp58DoW+dYPoATxe9qTVf6wgXYQp8T692SPZqSOGsPgPfP1Ui8s4ZZJURdgMfLTi/uLHSuUGYZqfl2RSvV8UybJwZzx1b05Np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
//		aliPayConfig.setAliPayPublicKey("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtojdtkETo4OEsQLeyyPwtWK9ZqYJANq6jjXC74vk9n/r88yW577y7VdxcK9X/F/wvR7D8of7lndYdhg6xZro0eO2skPZTU+A549J7tfzahVbIBAS+x1WPFJwPtVrfBBvkwHL8PT+YnMcxKyBxOa6wo8fzJs1NgU1+qnDCpwUFyv59GUfdzBvTPL1fY3ZzvRHFHbapevVltbO/jNV0thb8dafmcJXl8lnjQy3XlH3eTH28tlVfqickacfRl/WSD8WN3dGgF7dTDKYfSR7YB7jsHe6VzoHM3UnD9/yQbi/Z3ZrL7yOxEjq4tfrKlZIW7ZCoUpOU4QdPIRhLeC6nWyGrQIDAQAB");
//		aliPayConfig.setNotifyUrl("http://eagle.natapp1.cc/pay/notify"); //回调接口，需要启动E:\tools\natapp的natapp
//		aliPayConfig.setReturnUrl("http://eagle.natapp1.cc");

		aliPayConfig.setAppId(this.alipayAccountConfig.getAppId());
		aliPayConfig.setPrivateKey(this.alipayAccountConfig.getPrivateKey());
		aliPayConfig.setAliPayPublicKey(this.alipayAccountConfig.getAliPayPublicKey());
		//回调接口，需要启动E:\tools\natapp的natapp
		aliPayConfig.setNotifyUrl(this.alipayAccountConfig.getNotifyUrl());
		aliPayConfig.setReturnUrl(this.alipayAccountConfig.getReturnUrl());

		BestPayServiceImpl bestPayService = new BestPayServiceImpl();
		bestPayService.setWxPayConfig(wxPayConfig);
		bestPayService.setAliPayConfig(aliPayConfig);
		return bestPayService;
	}
}
